package org.zjt.rxjava.lession.second;

import io.reactivex.*;
import io.reactivex.observables.ConnectableObservable;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

/**
 * Description:         Runnable
 *
 *      它从来不发射数据，只处理 onComplete 和 onError 事件。可以看成是Rx的Runnable。
 *
 * @author juntao.zhang
 * Date: 2018-06-20 下午6:32
 * @see
 */
@Slf4j
public class CompletableTest {


    @Test
    public void createTest() {
        Maybe<String> maybe = Completable.fromCallable(() -> "wwww").andThen((MaybeSource) observer -> observer.onSuccess("2222"));
        maybe.subscribe(log::info);
    }


    @Test
    public void runTest() {
        Completable.fromRunnable(()-> log.info("----running---")).subscribe(() -> log.info("----done---"));
    }


}
